/**
 * @Title: UserBalanceContoler.java
 * @Package com.leesche.zcsp.node.web.controller.wechat.cash.balance
 * @Description:()
 * @author dennies yang
 * @date 2016年10月20日 下午3:05:13
 * @version V1.0
 */
package com.leesche.zcsp.node.app.v1.controller.income.balance;

import com.leesche.zcsp.node.utils.web.messge.WebResult;
import com.leesche.zcsp.node.web.service.SysUserBalanceService;
import com.leesche.zcsp.node.web.service.impl.data.read.QuerySysUserBalanceCondition;
import com.leesche.zcsp.node.web.service.privilege.PrivilegeService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author dennies yang
 * @version V1.0
 * @Title: UserBalanceContoler.java
 * @Package com.leesche.zcsp.node.web.controller.wechat.cash.balance
 * @Description:()
 * @date 2016年10月20日 下午3:05:13
 */
@Controller
@RequestMapping(value = "/app/v1/income/balance")
public class AppUserBalanceController {
    private static final Logger logger = Logger
            .getLogger(AppUserBalanceController.class);
    @Autowired
    PrivilegeService privilegeService;

    @Autowired
    SysUserBalanceService sysUserBalanceService;

    /**
     * @Title: listView @Description: TODO(打开用户对账单界面) @param @param model @param @return @return
     * String @throws
     */
    @ResponseBody
    @RequestMapping(value = "showView", method = RequestMethod.POST)
    public Map<String, Object> showView(Model model) {
        Long userId = privilegeService.getCurrentPrincipalForApp().getUserid();
        QuerySysUserBalanceCondition querySysUserBalanceCondition = new QuerySysUserBalanceCondition();
        querySysUserBalanceCondition.setUserId(userId);

        return WebResult.success().put("data", sysUserBalanceService
                .findByCondition(querySysUserBalanceCondition)).toMap();
    }

}
